<template>
	<view class="house-detail">
		<view class="roomInfo">房屋信息</view>
		<view class="content">
			<text>{{repairObj.houseInfo}}</text>
			<view class="right">
				<view class="success" v-if="repairObj.status===2">
					上门中
				</view>
				<view class="waiting" v-else-if="repairObj.status===1">
					受理中
				</view>
				<view class="error" v-else-if="repairObj.status===3">
					已完成
				</view>
				<view class="cancel" v-else>
					已取消
				</view>
			</view>
		</view>

		<view class="repairInfo">
			<view class="roomInfo">报修信息</view>
			<view class="buttom-message">
				<view class="cell">维修项目 <text class="message">{{repairObj.repairItemName}}</text></view>
				<view class="cell">手机号码 <text class="message">{{repairObj.mobile}}</text></view>
				<view class="cell">预约日期 <text class="message">{{repairObj.appointment}}</text></view>
				<view class="cell" style="border: none;">问题描述</view>
				<text class="content">{{repairObj.description}}</text>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		getRepairDetail
	} from '../../api/repair';
	export default {
		data() {
			return {
				repairObj: {}
			};
		},
		onLoad(options) {
			this.getRepairDetail(options.id)
		},
		methods: {
			async getRepairDetail(id) {
				const res = await getRepairDetail(id)
				console.log(res)
				this.repairObj = res.data
			}
		}
	}
</script>

<style lang="scss" scoped>
	.house-detail {
		height: 100%;
		background-color: #fafafa;

		.roomInfo {
			padding: 0 30rpx;
			line-height: 86rpx;
			color: #979797;
			font-size: 24rpx;
		}

		.content {
			width: 750rpx;
			height: 102rpx;
			background-color: #fff;
			padding: 0 30rpx;
			box-sizing: border-box;
			display: flex;
			justify-content: space-between;
			align-items: center;

			text {
				font-size: 28rpx;
				color: #333;
			}

			.right {
				.success {
					width: 128rpx;
					height: 48rpx;
					color: #27AE60;
					border-radius: 10rpx;
					background: #EBF8F0;
					font-size: 24rpx;
					line-height: 48rpx;
					text-align: center;
				}

				.waiting {
					width: 104rpx;
					height: 48rpx;
					border-radius: 10rpx;
					background: #E5F0FB;
					text-align: center;
					line-height: 48rpx;
					font-size: 24rpx;
					color: #2D9CDB;
				}

				.error {
					width: 128rpx;
					height: 48rpx;
					color: #DEAB48;
					border-radius: 10rpx;
					background: #FCF5E9;
					font-size: 24rpx;
					line-height: 48rpx;
					text-align: center;
				}

				.cancel {
					width: 128rpx;
					height: 48rpx;
					color: #979797;
					border-radius: 10rpx;
					background: #F2F2F6;
					font-size: 24rpx;
					line-height: 48rpx;
					text-align: center;
				}
			}
		}

		.repairInfo {
			.roomInfo {
				padding: 0 30rpx;
				line-height: 86rpx;
				color: #979797;
				font-size: 24rpx;
			}

			.buttom-message {
				background-color: #fff;

				.cell {
					padding-left: 30rpx;
					height: 102rpx;
					line-height: 102rpx;
					color: #333333;
					font-size: 28rpx;
					border-bottom: 1px solid #F2F2F6;

					.message {
						padding-left: 30rpx;
						margin-left: 100rpx;
						color: #333333;
						font-size: 28rpx;
					}
				}

				.content {
					display: block;
					border-bottom: 1px solid #F2F2F6;
					padding: 0rpx 0rpx 15rpx 30rpx;
					color: #333333;
					font-size: 28rpx;
					background-color: #fff;

				}
			}
		}
	}
</style>
